package com.yjht.system.web;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yjht.system.model.SysLog;
import com.yjht.common.result.EasyPage;
import com.yjht.common.result.PageVO;
import com.yjht.system.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 系统日志 前端控制器
 * </p>
 *
 * @author lengleng
 * @since 2018-03-31
 */
@Controller
@RequestMapping("/sysLog")
public class SysLogController {

    @Autowired private ISysLogService sysLogService;

    @GetMapping("/manager")
    public String manager() {
        return "system/sysLog/sysLogList";
    }

    @PostMapping("/dataGrid")
    @ResponseBody
    public EasyPage<SysLog> dataGrid(SysLog sysLog, PageVO pageVO) {
        EntityWrapper<SysLog> ew = new EntityWrapper<SysLog>(sysLog);
        Page<SysLog> pages = pageVO.toPage();
        sysLogService.selectPage(pages, ew);
        return EasyPage.of(pages);
    }
}
